﻿using System;


namespace XmlSockets.Internal
{

    internal struct XmlSocketReceiveContent:IXmlSocketReceiveContent
    {
        
        private byte[] _buffer;
        private int receiveLength;
        internal XmlSocketReceiveContent(byte[] buffer, int receiveLength)
        {
            this._buffer = buffer;
            this.receiveLength = receiveLength;

        }

        public int Read(byte[] buffer, int offset)
        {

            Array.ConstrainedCopy(this._buffer, 0, buffer, offset, receiveLength);

            return ReceiveLength;
        }


        public int ReceiveLength
        {
            get { return receiveLength; }
        }
    }
}
